Skip to content

Update protocol version #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 29, 2025

Conversation

cliffhall
Copy link
Contributor

@cliffhall cliffhall commented Apr 25, 2025

  • This fixes LATEST_PROTOCOL_VERSION is not set to "2025-03-26" #378
  • In types.ts
    • set LATEST_PROTOCOL_VERSION to "2025-03-26"
    • add "2025-03-26" to SUPPORTED_PROTOCOL_VERSIONS
  • In auth.test.ts
    • in test "returns metadata when discovery succeeds"
      • expect "MCP-Protocol-Version" to be "2025-03-26"
  • Added types.test.ts
    • "should have correct latest protocol version"
    • "should have correct supported protocol versions"

Motivation and Context

StreamableHttp is available in the current release of the SDK and people are finding that returning the newest protocol version from their servers can cause a failure to connect.

How Has This Been Tested?

Unit and integration tests pass. Lint has no errors.

Breaking Changes

Nope.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

* This fixes modelcontextprotocol#378
* In types.ts
  - set LATEST_PROTOCOL_VERSION to "2025-03-26"
  - add "2025-03-26" to SUPPORTED_PROTOCOL_VERSIONS
* In auth.test.ts
  - in test "returns metadata when discovery succeeds"
    - expect "MCP-Protocol-Version" to be "2025-03-26"
* Added types.test.ts
  - "should have correct latest protocol version"
  - "should have correct supported protocol versions"
* tidy types.test.ts
@ihrpr ihrpr added this to the release 1.10.3 milestone Apr 28, 2025
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this! Please can we have tests for version negotiations. Ideally we test:

  • old protocol server, new client
  • old protocol client, new server

@cliffhall
Copy link
Contributor Author

Thank you for working on this! Please can we have tests for version negotiations. Ideally we test:

  • old protocol server, new client
  • old protocol client, new server

It seems as if the bases are covered by the current crop of client and server tests. If you see a gap, I'm happy to close it.

Server version-handling tests

Screenshot 2025-04-28 at 3 00 04 PM

Client version-handling tests

Screenshot 2025-04-28 at 3 00 57 PM

@ihrpr
Copy link
Contributor

ihrpr commented Apr 28, 2025

Thank you for working on this! Please can we have tests for version negotiations. Ideally we test:

  • old protocol server, new client
  • old protocol client, new server

It seems as if the bases are covered by the current crop of client and server tests. If you see a gap, I'm happy to close it.

Server version-handling tests

Screenshot 2025-04-28 at 3 00 04 PM ### [Client version-handling tests](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/client/index.test.ts#L23) Screenshot 2025-04-28 at 3 00 57 PM

Those tests have loads of mocking, I think if we can just check manually if all works fine for both of the cases that would be great.

* In src/client/index.test.ts added tests:
  - "should connect new client to old, supported server version"
  - should negotiate version when client is old, and newer server supports its version"
  - "should throw when client is old, and server doesn't support its version"
@cliffhall
Copy link
Contributor Author

Those tests have loads of mocking, I think if we can just check manually if all works fine for both of the cases that would be great.

Fair enough. Added some straightforward mock-less tests. Have a look.

@cliffhall cliffhall requested a review from ihrpr April 28, 2025 21:59
* In src/client/index.test.ts added tests:
  - "should connect new client to old, supported server version"
  - should negotiate version when client is old, and newer server supports its version"
  - "should throw when client is old, and server doesn't support its version"
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@ihrpr ihrpr merged commit b0255e5 into modelcontextprotocol:main Apr 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LATEST_PROTOCOL_VERSION is not set to "2025-03-26"
2 participants